/*
	by Ilija
*/


#include "GLShader.h"

char* loadString(const char* filename)  { return NULL; }


GLShader::GLShader()
{
	m_ProgId = 0;
	m_ProgType = 0;
}

GLShader::~GLShader()
{
	//dtor
}


bool GLShader::loadFromFile(const char* filename)
{
#if 0
	if (GLEE_ARB_fragment_program)
	{
		GLenum type = GL_FRAGMENT_PROGRAM_ARB;
		char* program_string = loadString(filename);
		if (!program_string)
		{
			char exec_str[128];
			sprintf(exec_str, "cgc -arbfp1 -o %s.pso %s.cg", filename, filename);
			if (system(exec_str))
			{
				return false;
			}
			program_string = loadString(filename);
			if (!program_string)
			{
				return false;
			}
		}

		glEnable(type);
		glGenProgramsARB(1, &m_ProgId);
		glBindProgramARB(type, m_ProgId);
		glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(program_string), program_string);
		glDisable(GL_FRAGMENT_PROGRAM_ARB);

		m_ProgType = type;
		return true;
	}
#endif
	return false;
}
